package com.jackwoo.test;

import org.junit.Test;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Author: StupidZhe
 * Date: 2019/11/19
 * Desc:
 **/
public class ServerSocketTestDrive {
    @Test
    public void serverSocketTest() throws IOException {
        ServerSocket serverSocket = new ServerSocket(8080, 1);
        while (true) {
            Socket socket = serverSocket.accept();
            System.out.println(socket.getLocalPort());
        }
    }

    @Test
    public void client1() throws IOException {
        Socket socket = new Socket("127.0.0.1",8080);
        while (true) {}

    }
    @Test
    public void client2() throws IOException {
        Socket socket = new Socket("127.0.0.1",8080);
        while (true) {}
    }
}
